*Black, Owens, Wedeking & Wohlfarth
*Chapter 12 Replication

use "Ch-12_Data.dta", clear

*Figure 12.1: Descriptive barplot
egen propRecusal = mean(satout2), by(term)
egen totRecusal = total(satout2), by(caseId)
egen asdf = seq(), by(caseId)
gen caseRecusal = 1 == (totRecusal > 0) if asdf == 1
egen caseRecusalProp = mean(caseRecusal), by(term)
duplicates drop term, force
keep term propRecusal caseRecusalProp
la var propRecusal "Proportion of Recusals at Justice Level"
la var caseRecusalProp "Proportion of Cases with One or More Recusals"
*Figure 12.1(a)
twoway bar propRecusal term, lcolor(black) lwidth(thin) scheme(s1mono) xtitle(Supreme Court Term) xlabel(1945(5)2010)
*Figure 12.1(b)
twoway bar caseRecusalProp term, lcolor(black) lwidth(thin) scheme(s1mono) xtitle(Supreme Court Term) xlabel(1945(5)2010)

*Table 12.1
use "Ch-12_Data.dta", clear

*Model 1
logit satout2 consciPI agreePI neuroPI openPI extraPI, cluster(caseId)

*Model 2
logit satout2 consciPI agreePI neuroPI openPI extraPI business2 service service2 sg servicesg judge servicejudge lcdisagreement lcDisagreement conflict nytSalience statutory  medideodist medideodistsq medideodistcu Vinson Warren Rehnquist Roberts, cluster(caseId)

*Figure 12.2: Effect of conscientiousness
quietly margins, at(consciPI=(-3.7(.1)1.2) (median))
marginsplot, xlabel(-3.7(.5)1.2) plotopt(msymbol(none)) ciopts(color(gs10)) recastci(rarea) level(90) xtitle(Supreme Court Justice Conscientiousness) ytitle(Predicted Probability of Recusal) title("") scheme(s1mono)

* Statutory Considerations: business2 service service2 sg servicesg judge servicejudge

* Business Petitioner/Respondent: Figure 12-3
logit satout2 agreePI neuroPI openPI extraPI c.consciPI##business2 service service2 sg servicesg judge servicejudge medideodist medideodistsq medideodistcu lcdisagreement lcDisagreement conflict nytSalience statutory Vinson Warren Rehnquist Roberts, cluster(caseId)
quietly margins, at(consciPI=(-3.7 1.2) business2=(0 1 2) (median))
marginsplot, x(business2) plotopt(mcolor(black)) level(90) recast(connected) xtitle(Business Litigants) ytitle(Predicted Probability of Recusal) title("") scheme(s1mono)
margins, dydx(business2) at(consciPI=(-3.5 1.2))

* Years of service: Figure 12-9
logit satout2 agreePI neuroPI openPI extraPI business2 c.consciPI##c.service##c.service sg servicesg judge servicejudge medideodist medideodistsq medideodistcu lcdisagreement lcDisagreement conflict nytSalience statutory Vinson Warren Rehnquist Roberts, cluster(caseId)
margins, at(consciPI=(-3.7 1.2) service=(0 3 6 9 12 15 18 21 24) (median))
marginsplot, x(service) plotopt(mcolor(black)) level(90) xtitle(Years of Service) ytitle(Predicted Probability of Recusal) title("") scheme(s1mono)
margins, dydx(service) at(consciPI =(-3.5 1.2)) post
margins, coeflegend
test _b[service:1bn._at] =  _b[service:2._at]

* SG service: Figure 12-10
logit satout2 agreePI neuroPI openPI extraPI business2 c.service##c.service c.consciPI##i.sg##c.service judge servicejudge medideodist medideodistsq medideodistcu lcdisagreement lcDisagreement conflict nytSalience statutory Vinson Warren Rehnquist Roberts, cluster(caseId)
margins, at(consciPI=(-.55 0.90) sg=1 service=(0 3 6 9 12 15 18) (median))
marginsplot, x(service) plotopt(mcolor(black)) level(90) xtitle(Years of Service by Former SG) ytitle(Predicted Probability of Recusal) title("") scheme(s1mono)
margins, dydx(service) at(consciPI =(-.55 0.90)) post
margins, coeflegend
test _b[service:1bn._at] =  _b[service:2._at]

* Judge service: Figure 12-4
logit satout2 agreePI neuroPI openPI extraPI business2 c.service##c.service servicesg i.judge##c.consciPI##c.service medideodist medideodistsq medideodistcu lcdisagreement lcDisagreement conflict nytSalience statutory Vinson Warren Rehnquist Roberts, cluster(caseId)
margins, at(consciPI=(-1.9 0.90) judge=1 service=(0 3 6 9 12 15 18) (median))
marginsplot, x(service) plotopt(mcolor(black)) level(90) xtitle(Years of Service by Former Federal Judge) ytitle(Predicted Probability of Recusal) title("") scheme(s1mono)

* Institutional Considerations: lcDisagreement conflict nytSalience statutory

* Dissent below: Figure 12-5
logit satout2 agreePI neuroPI openPI extraPI business2 service service2 sg servicesg judge servicejudge c.consciPI##lcDisagreement conflict nytSalience statutory medideodist medideodistsq medideodistcu lcdisagreement Vinson Warren Rehnquist Roberts, cluster(caseId)
margins, dydx(lcDisagreement) at(consci=(-3.7 (.1) 1.2)) post
marginsplot, xlabel(-3.7(.5)1.2) plotopt(msymbol(none)) ciopts(color(gs10)) recastci(rarea) level(90) ylin(0) xtitle(Supreme Court Justice Conscientiousness) ytitle(Marginal Effect of Dissent Below) title("") scheme(s1mono)

* Conflict: Figure 12-11
logit satout2 agreePI neuroPI openPI extraPI business2 service service2 sg servicesg judge servicejudge lcDisagreement c.consciPI##conflict nytSalience statutory medideodist medideodistsq medideodistcu lcdisagreement Vinson Warren Rehnquist Roberts, cluster(caseId)
margins, dydx(conflict) at(consci=(-3.7 (.1) 1.2)) post
marginsplot, xlabel(-3.7(.5)1.2) plotopt(msymbol(none)) ciopts(color(gs10)) recastci(rarea) level(90) ylin(0) xtitle(Supreme Court Justice Conscientiousness) ytitle(Marginal Effect of Conflict) title("") scheme(s1mono)

* Salience: Figure 12-12
logit satout2 agreePI neuroPI openPI extraPI business2 service service2 sg servicesg judge servicejudge lcDisagreement conflict c.consciPI##nytSalience statutory medideodist medideodistsq medideodistcu lcdisagreement Vinson Warren Rehnquist Roberts, cluster(caseId)
margins, dydx(nytSalience) at(consci=(-3.7 (.1) 1.2)) post
marginsplot, xlabel(-3.7(.5)1.2) plotopt(msymbol(none)) ciopts(color(gs10)) recastci(rarea) level(90) ylin(0) xtitle(Supreme Court Justice Conscientiousness) ytitle(Marginal Effect of Case Salience) title("") scheme(s1mono)

* Statutory: Figure 12-6
logit satout2 agreePI neuroPI openPI extraPI business2 service service2 sg servicesg judge servicejudge lcDisagreement conflict nytSalience c.consciPI##statutory medideodist medideodistsq medideodistcu lcdisagreement Vinson Warren Rehnquist Roberts, cluster(caseId)
margins, dydx(statutory) at(consci=(-3.7 (.1) 1.2)) post
marginsplot, xlabel(-3.7(.5)1.2) plotopt(msymbol(none)) ciopts(color(gs10)) recastci(rarea) level(90) ylin(0) xtitle(Supreme Court Justice Conscientiousness) ytitle(Marginal Effect of Case Statutory) title("") scheme(s1mono)

* Policy Considerations: medideodist lcdisagreement

* Median Distance: Figure 12-7a and Figure 12-7b
logit satout2 agreePI neuroPI openPI extraPI business2 service service2 sg servicesg judge servicejudge lcDisagreement conflict nytSalience statutory c.consciPI##c.medideodist##c.medideodist##c.medideodist lcdisagreement Vinson Warren Rehnquist Roberts, cluster(caseId)
quietly margins, at(consciPI=(-3.7 1.2) medideodist=(0 (0.25) 4.7) (median))
marginsplot, x(medideodist) xlabel(0(0.5)4.5) plotopt(msymbol(none)) noci xtitle(Ideological Distance from Median) ytitle(Predicted Probability of Recusal) title("") scheme(s1mono) legend(order(1 "Low Conscientiousness" 2 "High Conscientiousness"))
quietly margins, dydx(consciPI) at(medideodist=(0 (0.25) 4.7) (median))
marginsplot, xlab(0(0.5)4.5) plotopt(msymbol(none)) ciopts(color(gs10)) recastci(rarea)  level(90) xtitle(Ideological Distance from Median) ytitle(Marginal Effect of Justice Conscientiousness) title("") scheme(s1mono) ylin(0)

* Lower Court Distance: Figure 12-13a/b
logit satout2 agreePI neuroPI openPI extraPI business2 service service2 sg servicesg judge servicejudge lcDisagreement conflict nytSalience statutory medideodist medideodistsq medideodistcu c.consciPI##c.lcdisagreement Vinson Warren Rehnquist Roberts, cluster(caseId)
quietly margins, at(consciPI=(-3.7 1.2) lcdisagreement=(-6.7 (1) 6.7) (median))
marginsplot, x(lcdisagreement) plotopt(msymbol(none)) noci xtitle(Ideological Distance from Lower Court) ytitle(Predicted Probability of Recusal) title("") scheme(s1mono) legend(order(1 "Low Conscientiousness" 2 "High Conscientiousness"))
quietly margins, dydx(consciPI) at(lcdisagreement=(-6.7 (1) 6.7) (median))
marginsplot, plotopt(msymbol(none)) ciopts(color(gs10)) recastci(rarea)  level(90) xtitle(Ideological Distance from Lower Court) ytitle(Marginal Effect of Justice Conscientiousness) title("") scheme(s1mono) ylin(0)

* CJ Regimes
gen Chief = 1 if Vinson == 1 & Warren == 0 & Rehnquist == 0 & Roberts == 0
replace Chief = 2 if Vinson == 0 & Warren == 1 & Rehnquist == 0 & Roberts == 0
replace Chief = 3 if Vinson == 0 & Warren == 0 & Rehnquist == 0 & Roberts == 0
replace Chief = 4 if Vinson == 0 & Warren == 0 & Rehnquist == 1 & Roberts == 0
replace Chief = 5 if Vinson == 0 & Warren == 0 & Rehnquist == 0 & Roberts == 1

* Figure 12-8a
logit satout2 consciPI agreePI neuroPI openPI extraPI business2 service service2 sg servicesg judge servicejudge lcDisagreement conflict nytSalience statutory medideodist medideodistsq medideodistcu lcdisagreement i.Chief, cluster(caseId)
margins Chief, post
marginsplot, xlabel(1 "Vinson" 2 "Warren" 3 "Burger" 4 "Rehnquist" 5 "Roberts") scheme(s1mono) xtitle("") ytitle(Predicted Probability of Recusal) title("")
test _b[1.Chief] = _b[2.Chief]
test _b[2.Chief] = _b[3.Chief]
test _b[3.Chief] = _b[4.Chief]
test _b[4.Chief] = _b[5.Chief]

* Figure 12-8b
logit satout2 agreePI neuroPI openPI extraPI business2 service service2 sg servicesg judge servicejudge lcDisagreement conflict nytSalience statutory medideodist medideodistsq medideodistcu lcdisagreement c.consciPI##i.Chief, cluster(caseId)
margins Chief, at(consciPI=(-3.7 1.2)) post
marginsplot, x(Chief) xlabel(1 "Vinson" 2 "Warren" 3 "Burger" 4 "Rehnquist" 5 "Roberts") scheme(s1mono) xtitle("") ytitle(Predicted Probability of Recusal) title("")
test _b[2bn._at#1.Chief] = _b[2bn._at#2.Chief]
test _b[2bn._at#2.Chief] = _b[2bn._at#3.Chief]
test _b[2bn._at#3.Chief] = _b[2bn._at#4.Chief]
test _b[1bn._at#3.Chief] = _b[1bn._at#4.Chief]
test _b[1bn._at#3.Chief] = _b[1bn._at#5.Chief]


